package com.healthshare.parse;

import org.json.JSONException;

import com.palmedia.framework.parse.BaseParse;




/**
 * @author xudeliang
 * 应答解析 
 */
public class RetCodeParse extends BaseParse
{

	/*{
"retcodet":"1"


	*/
	
	public String statuscode="1";//0成功
	
	public String status;
	
	public String userid;//注册的时候有用
	public RetCodeParse()
	{
		
	}
	
	@Override
	public boolean Parse(byte[]data)
	{
		boolean ret = super.Parse(data);
		if(!ret)
		{
			return false;
		}
		if(JSON==parseType)
		{
			try 
			{
				statuscode = jsonObject.getString("statuscode");
				status = jsonObject.getString("status");
				boolean isuser = jsonObject.isNull("userid");
				if(!isuser)
				{
					userid = jsonObject.getString("userid");
				}
				return true;
			} 
			catch (JSONException e) 
			{
				e.printStackTrace();
			}
		}
		return false;
	}
	
}
